package zy1208.zy14;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;

public class demo {
    public static void main(String[] args) throws Exception {
        List<String> lines = FileUtils.readLines(new File("D:\\ideadashuju12\\liu_ya_kai\\src\\zy1208\\zy14\\data.properties"));
        Class<?> aClass = Class.forName("zy1208.zy14.User");
        Object o = aClass.newInstance();
        for (String line : lines) {
            String[] split = line.split("=");
            Field f = aClass.getDeclaredField(split[0]);
            f.setAccessible(true);
            f.set(o,split[1]);
        }
        Method ts = aClass.getDeclaredMethod("toString");
        Object o1 = ts.invoke(o);
        System.out.println(o1);
    }
}
